<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
</head>
<body>
    <p>大哥</p>
    <div id="outer">
        <span>大儿子</span>
        <div>
            <span>大孙子</span>
        </div>
        <span>二闺女</span>
    </div>
    <p>三弟</p>
    <p>四妹</p>

    <script>
        let outer = document.getElementById("outer");
        //1. 获取outer的父标签,支持链式编程
        let parents = outer.parentElement.parentElement;
        console.log(parents.nodeName);//标签的名称

        //2. 获取所有的子标签 - 直接
        let childs = outer.children;
        console.log(childs.length) // 3
        console.log(childs[1].nodeName) // DIV
        console.log(childs[1].children[0])

        //3. 获取上一个紧紧相邻的节点
        let brother01 = outer.previousElementSibling;
        console.log(brother01)

        //4. 获取下一个紧紧相邻的节点
        let brother02 = outer.nextElementSibling;
        console.log(brother02)
    </script>
</body>
</html>